<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Archive::Tar - module for manipulations of tar archives - Perldoc Browser</title>
    <link rel="search" href="https://perldoc.perl.org/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser">
    <link rel="canonical" href="https://perldoc.perl.org/Archive::Tar">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" />
    <style>
      body {
        background: #f4f4f5;
        color: #020202;
      }
      .navbar-dark {
        background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%);
        background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%);
        filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0);
        background-repeat: repeat-x;
      }
      .navbar-dark .navbar-nav .nav-link,
      .navbar-dark .navbar-nav .nav-link:focus { color: #fff }
      .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 }
      #wrapperlicious {
        margin: 0 auto;
        font: 0.9em 'Helvetica Neue', Helvetica, sans-serif;
        font-weight: normal;
        line-height: 1.5em;
        margin: 0;
        padding: 0;
      }
      #wrapperlicious h1 { font-size: 1.5em }
      #wrapperlicious h2 { font-size: 1.3em }
      #wrapperlicious h3 { font-size: 1.1em }
      #wrapperlicious h4 { font-size: 0.9em }
      #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3,
      #wrapperlicious h4, #wrapperlicious dt {
        color: #020202;
        margin-top: 1em;
        margin-bottom: 1em;
        position: relative;
        font-weight: bold;
      }
      #wrapperlicious a { color: inherit; text-decoration: underline }
      #wrapperlicious #toc { text-decoration: none }
      #wrapperlicious a:hover { color: #2a2a2a }
      #wrapperlicious a img { border: 0 }
      #wrapperlicious :not(pre) > code {
        color: inherit;
        background-color: rgba(0, 0, 0, 0.04);
        border-radius: 3px;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        padding: 0.3em;
      }
      #wrapperlicious dd {
        margin: 0;
        margin-left: 2em;
      }
      #wrapperlicious dt {
        color: #2a2a2a;
        font-weight: bold;
        margin-left: 0.9em;
      }
      #wrapperlicious p {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious li > p {
        margin-bottom: 0;
        margin-top: 0;
      }
      #wrapperlicious pre {
        border: 1px solid #c1c1c1;
        border-radius: 3px;
        font: 100% Consolas, Menlo, Monaco, monospace;
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious pre > code {
        display: block;
        background-color: #f6f6f6;
        font: 0.9em Consolas, Menlo, Monaco, monospace;
        line-height: 1.5em;
        text-align: left;
        white-space: pre;
        padding: 1em;
      }
      #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul {
        margin-bottom: 1em;
        margin-top: 1em;
      }
      #wrapperlicious ul {
        list-style-type: square;
      }
      #wrapperlicious ul ul {
        margin-bottom: 0px;
        margin-top: 0px;
      }
      #footer {
        font-size: 0.8em;
        padding-top: 0.5em;
        text-align: center;
      }
      #more {
        display: inline;
        font-size: 0.8em;
      }
      #perldocdiv {
        background-color: #fff;
        border: 1px solid #c1c1c1;
        border-bottom-left-radius: 5px;
        border-bottom-right-radius: 5px;
        margin-left: auto;
        margin-right: auto;
        padding: 3em;
        padding-top: 1em;
        max-width: 960px;
      }
      #moduleversion { float: right }
      #wrapperlicious .leading-notice {
        font-style: italic;
        padding-left: 1em;
        margin-top: 1em;
        margin-bottom: 1em;
      }
      #wrapperlicious .permalink {
        display: none;
        left: -0.75em;
        position: absolute;
        padding-right: 0.25em;
        text-decoration: none;
      }
      #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink,
      #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink,
      #wrapperlicious dt:hover .permalink {
        display: block;
      }
    </style>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-KVNWBNT5FB');
      gtag('config', 'UA-50555-3');
    </script>
  </head>
  <body>
    <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between">
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="https://perldoc.perl.org/">Perldoc Browser</a>
  <div class="collapse navbar-collapse" id="navbarNav">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Archive::Tar.html#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.35.0</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-stable">
          <a class="dropdown-item" href="https://perldoc.perl.org/Archive::Tar">Latest</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.2/Archive::Tar">5.38.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.1/Archive::Tar">5.38.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0/Archive::Tar">5.38.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.3/Archive::Tar">5.36.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.2/Archive::Tar">5.36.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.1/Archive::Tar">5.36.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.36.0/Archive::Tar">5.36.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.3/Archive::Tar">5.34.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.2/Archive::Tar">5.34.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.1/Archive::Tar">5.34.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.34.0/Archive::Tar">5.34.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.1/Archive::Tar">5.32.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.32.0/Archive::Tar">5.32.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.3/Archive::Tar">5.30.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.2/Archive::Tar">5.30.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.1/Archive::Tar">5.30.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.30.0/Archive::Tar">5.30.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.3/Archive::Tar">5.28.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.2/Archive::Tar">5.28.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.1/Archive::Tar">5.28.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.28.0/Archive::Tar">5.28.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.3/Archive::Tar">5.26.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.2/Archive::Tar">5.26.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.1/Archive::Tar">5.26.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.26.0/Archive::Tar">5.26.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.4/Archive::Tar">5.24.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.3/Archive::Tar">5.24.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.2/Archive::Tar">5.24.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.1/Archive::Tar">5.24.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.24.0/Archive::Tar">5.24.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.4/Archive::Tar">5.22.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.3/Archive::Tar">5.22.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.2/Archive::Tar">5.22.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.1/Archive::Tar">5.22.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.22.0/Archive::Tar">5.22.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.3/Archive::Tar">5.20.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.2/Archive::Tar">5.20.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.1/Archive::Tar">5.20.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.20.0/Archive::Tar">5.20.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.4/Archive::Tar">5.18.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.3/Archive::Tar">5.18.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.2/Archive::Tar">5.18.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.1/Archive::Tar">5.18.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.18.0/Archive::Tar">5.18.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.3/Archive::Tar">5.16.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.2/Archive::Tar">5.16.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.1/Archive::Tar">5.16.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.16.0/Archive::Tar">5.16.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.4/Archive::Tar">5.14.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.3/Archive::Tar">5.14.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.2/Archive::Tar">5.14.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.1/Archive::Tar">5.14.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.14.0/Archive::Tar">5.14.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.5/Archive::Tar">5.12.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.4/Archive::Tar">5.12.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.3/Archive::Tar">5.12.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.2/Archive::Tar">5.12.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.1/Archive::Tar">5.12.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.12.0/Archive::Tar">5.12.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.1/Archive::Tar">5.10.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.10.0/Archive::Tar">5.10.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.9/Archive::Tar">5.8.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.8/Archive::Tar">5.8.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.7/Archive::Tar">5.8.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.6/Archive::Tar">5.8.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.5/Archive::Tar">5.8.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.4/Archive::Tar">5.8.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.3/Archive::Tar">5.8.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.2/Archive::Tar">5.8.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.1/Archive::Tar">5.8.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.8.0/Archive::Tar">5.8.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.2/Archive::Tar">5.6.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.1/Archive::Tar">5.6.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.6.0/Archive::Tar">5.6.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_04/Archive::Tar">5.005_04</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_03/Archive::Tar">5.005_03</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_02/Archive::Tar">5.005_02</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005_01/Archive::Tar">5.005_01</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.005/Archive::Tar">5.005</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Archive::Tar.html#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-dev">
          <a class="dropdown-item" href="https://perldoc.perl.org/blead/Archive::Tar">blead</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.6/Archive::Tar">5.39.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.5/Archive::Tar">5.39.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.4/Archive::Tar">5.39.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.3/Archive::Tar">5.39.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.2/Archive::Tar">5.39.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.39.1/Archive::Tar">5.39.1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC2/Archive::Tar">5.38.0-RC2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.38.0-RC1/Archive::Tar">5.38.0-RC1</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.11/Archive::Tar">5.37.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.10/Archive::Tar">5.37.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.9/Archive::Tar">5.37.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.8/Archive::Tar">5.37.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.7/Archive::Tar">5.37.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.6/Archive::Tar">5.37.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.5/Archive::Tar">5.37.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.4/Archive::Tar">5.37.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.3/Archive::Tar">5.37.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.2/Archive::Tar">5.37.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.1/Archive::Tar">5.37.1</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.37.0/Archive::Tar">5.37.0</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.11/Archive::Tar">5.35.11</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.10/Archive::Tar">5.35.10</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.9/Archive::Tar">5.35.9</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.8/Archive::Tar">5.35.8</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.7/Archive::Tar">5.35.7</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.6/Archive::Tar">5.35.6</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.5/Archive::Tar">5.35.5</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.4/Archive::Tar">5.35.4</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.3/Archive::Tar">5.35.3</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.2/Archive::Tar">5.35.2</a>
          <a class="dropdown-item" href="https://perldoc.perl.org/5.35.1/Archive::Tar">5.35.1</a>
          <a class="dropdown-item active" href="./Archive::Tar.html">5.35.0</a>
        </div>
      </li>
      <li class="nav-item dropdown text-nowrap">
        <a class="nav-link dropdown-toggle" href="./Archive::Tar.html#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a>
        <div class="dropdown-menu" aria-labelledby="dropdownlink-nav">
          <a class="dropdown-item" href="perl.html">Perl</a>
          <a class="dropdown-item" href="perlintro.html">Intro</a>
          <a class="dropdown-item" href="perl.html#Tutorials">Tutorials</a>
          <a class="dropdown-item" href="perlfaq.html">FAQs</a>
          <a class="dropdown-item" href="perl.html#Reference-Manual">Reference</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlop.html">Operators</a>
          <a class="dropdown-item" href="functions.html">Functions</a>
          <a class="dropdown-item" href="variables.html">Variables</a>
          <a class="dropdown-item" href="modules.html">Modules</a>
          <a class="dropdown-item" href="perlutil.html">Utilities</a>
          <div class="dropdown-divider"></div>
          <a class="dropdown-item" href="perlcommunity.html">Community</a>
          <a class="dropdown-item" href="perlhist.html">History</a>
        </div>
      </li>
    </ul>
    <ul class="navbar-nav">
      <script>
        function set_expand (expand) {
          var perldocdiv = document.getElementById('perldocdiv');
          var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width');
          var expanded = (width == '' || width == 'none') ? true : false;
          if (expand === null) {
            expand = !expanded;
          }
          if ((expand && !expanded) || (!expand && expanded)) {
            perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px');
            var button_classlist = document.getElementById('content-expand-button').classList;
            if (expand) {
              button_classlist.add('btn-light');
              button_classlist.remove('btn-outline-light');
            } else {
              button_classlist.add('btn-outline-light');
              button_classlist.remove('btn-light');
            }
          }
          return expand;
        }
        function toggle_expand () {
          var expand = set_expand(null);
          document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC';
        }
        function read_expand () {
          return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 });
        }
        if (document.readyState === 'loading') {
          document.addEventListener('DOMContentLoaded', function () {
            if (read_expand()) {
              set_expand(true);
            }
          });
        } else if (read_expand()) {
          set_expand(true);
        }
      </script>
      <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-2" onclick="toggle_expand()">Expand</button>
    <ul>
    <form class="form-inline" method="get" action="https://perldoc.perl.org/5.35.0/search">
      <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search">
    </form>
  </div>
</nav>

    <div id="wrapperlicious" class="container-fluid">
      <div id="perldocdiv">
        <div id="links">
          <a href="./Archive::Tar.html">Archive::Tar</a>
          <div id="more">
            (<a href="./Archive::Tar.txt">source</a>,
            <a href="https://metacpan.org/pod/Archive::Tar">CPAN</a>)
          </div>
            <div id="moduleversion">version 2.38</div>
        </div>
        <div class="leading-notice">
          You are viewing the version of this documentation from Perl 5.35.0.
            This is a development version of Perl.
        </div>
        <h1><a id="toc">CONTENTS</a></h1>
                  <ul>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#NAME">NAME</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#SYNOPSIS">SYNOPSIS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#DESCRIPTION">DESCRIPTION</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#Object-Methods">Object Methods</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#Archive::Tar-%3Enew(-%5B$file,-$compressed%5D-)">Archive::Tar-&gt;new( [$file, $compressed] )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Eread-(-$filename%7C$handle,-%5B$compressed,-%7Bopt-=%3E-&#39;val&#39;%7D%5D-)">$tar-&gt;read ( $filename|$handle, [$compressed, {opt =&gt; &#39;val&#39;}] )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Econtains_file(-$filename-)">$tar-&gt;contains_file( $filename )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Eextract(-%5B@filenames%5D-)">$tar-&gt;extract( [@filenames] )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Eextract_file(-$file,-%5B$extract_path%5D-)">$tar-&gt;extract_file( $file, [$extract_path] )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Elist_files(-%5B%5C@properties%5D-)">$tar-&gt;list_files( [\@properties] )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Eget_files(-%5B@filenames%5D-)">$tar-&gt;get_files( [@filenames] )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Eget_content(-$file-)">$tar-&gt;get_content( $file )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Ereplace_content(-$file,-$content-)">$tar-&gt;replace_content( $file, $content )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Erename(-$file,-$new_name-)">$tar-&gt;rename( $file, $new_name )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Echmod(-$file,-$mode-)">$tar-&gt;chmod( $file, $mode )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Echown(-$file,-$uname-%5B,-$gname%5D-)">$tar-&gt;chown( $file, $uname [, $gname] )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Eremove-(@filenamelist)">$tar-&gt;remove (@filenamelist)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Eclear">$tar-&gt;clear</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Ewrite-(-%5B$file,-$compressed,-$prefix%5D-)">$tar-&gt;write ( [$file, $compressed, $prefix] )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Eadd_files(-@filenamelist-)">$tar-&gt;add_files( @filenamelist )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Eadd_data-(-$filename,-$data,-%5B$opthashref%5D-)">$tar-&gt;add_data ( $filename, $data, [$opthashref] )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Eerror(-%5B$BOOL%5D-)">$tar-&gt;error( [$BOOL] )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$tar-%3Esetcwd(-$cwd-);">$tar-&gt;setcwd( $cwd );</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#Class-Methods">Class Methods</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#Archive::Tar-%3Ecreate_archive($file,-$compressed,-@filelist)">Archive::Tar-&gt;create_archive($file, $compressed, @filelist)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#Archive::Tar-%3Eiter(-$filename,-%5B-$compressed,-%7Bopt-=%3E-$val%7D-%5D-)">Archive::Tar-&gt;iter( $filename, [ $compressed, {opt =&gt; $val} ] )</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#Archive::Tar-%3Elist_archive($file,-$compressed,-%5B%5C@properties%5D)">Archive::Tar-&gt;list_archive($file, $compressed, [\@properties])</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#Archive::Tar-%3Eextract_archive($file,-$compressed)">Archive::Tar-&gt;extract_archive($file, $compressed)</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$bool-=-Archive::Tar-%3Ehas_io_string">$bool = Archive::Tar-&gt;has_io_string</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$bool-=-Archive::Tar-%3Ehas_perlio">$bool = Archive::Tar-&gt;has_perlio</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$bool-=-Archive::Tar-%3Ehas_zlib_support">$bool = Archive::Tar-&gt;has_zlib_support</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$bool-=-Archive::Tar-%3Ehas_bzip2_support">$bool = Archive::Tar-&gt;has_bzip2_support</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$bool-=-Archive::Tar-%3Ehas_xz_support">$bool = Archive::Tar-&gt;has_xz_support</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#Archive::Tar-%3Ecan_handle_compressed_files">Archive::Tar-&gt;can_handle_compressed_files</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#GLOBAL-VARIABLES">GLOBAL VARIABLES</a>
                            <ul>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$Archive::Tar::FOLLOW_SYMLINK">$Archive::Tar::FOLLOW_SYMLINK</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$Archive::Tar::CHOWN">$Archive::Tar::CHOWN</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$Archive::Tar::CHMOD">$Archive::Tar::CHMOD</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$Archive::Tar::SAME_PERMISSIONS">$Archive::Tar::SAME_PERMISSIONS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$Archive::Tar::DO_NOT_USE_PREFIX">$Archive::Tar::DO_NOT_USE_PREFIX</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$Archive::Tar::DEBUG">$Archive::Tar::DEBUG</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$Archive::Tar::WARN">$Archive::Tar::WARN</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$Archive::Tar::error">$Archive::Tar::error</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$Archive::Tar::INSECURE_EXTRACT_MODE">$Archive::Tar::INSECURE_EXTRACT_MODE</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$Archive::Tar::HAS_PERLIO">$Archive::Tar::HAS_PERLIO</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$Archive::Tar::HAS_IO_STRING">$Archive::Tar::HAS_IO_STRING</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#$Archive::Tar::ZERO_PAD_NUMBERS">$Archive::Tar::ZERO_PAD_NUMBERS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#Tuning-the-way-RESOLVE_SYMLINK-will-works">Tuning the way RESOLVE_SYMLINK will works</a>
              </li>
          </ul>

              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#FAQ">FAQ</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#CAVEATS">CAVEATS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#TODO">TODO</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#SEE-ALSO">SEE ALSO</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#AUTHOR">AUTHOR</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#ACKNOWLEDGEMENTS">ACKNOWLEDGEMENTS</a>
              </li>
              <li>
                <a class="text-decoration-none" href="./Archive::Tar.html#COPYRIGHT">COPYRIGHT</a>
              </li>
          </ul>

      <h1 id="NAME"><a class="permalink" href="./Archive::Tar.html#NAME">#</a>NAME</h1>

<p>Archive::Tar - module for manipulations of tar archives</p>

<h1 id="SYNOPSIS"><a class="permalink" href="./Archive::Tar.html#SYNOPSIS">#</a>SYNOPSIS</h1>

<pre><code>use Archive::Tar;
my $tar = Archive::Tar-&gt;new;

$tar-&gt;read(&#39;origin.tgz&#39;);
$tar-&gt;extract();

$tar-&gt;add_files(&#39;file/foo.pl&#39;, &#39;docs/README&#39;);
$tar-&gt;add_data(&#39;file/baz.txt&#39;, &#39;This is the contents now&#39;);

$tar-&gt;rename(&#39;oldname&#39;, &#39;new/file/name&#39;);
$tar-&gt;chown(&#39;/&#39;, &#39;root&#39;);
$tar-&gt;chown(&#39;/&#39;, &#39;root:root&#39;);
$tar-&gt;chmod(&#39;/tmp&#39;, &#39;1777&#39;);

$tar-&gt;write(&#39;files.tar&#39;);                   # plain tar
$tar-&gt;write(&#39;files.tgz&#39;, COMPRESS_GZIP);    # gzip compressed
$tar-&gt;write(&#39;files.tbz&#39;, COMPRESS_BZIP);    # bzip2 compressed
$tar-&gt;write(&#39;files.txz&#39;, COMPRESS_XZ);      # xz compressed</code></pre>

<h1 id="DESCRIPTION"><a class="permalink" href="./Archive::Tar.html#DESCRIPTION">#</a>DESCRIPTION</h1>

<p>Archive::Tar provides an object oriented mechanism for handling tar files. It provides class methods for quick and easy files handling while also allowing for the creation of tar file objects for custom manipulation. If you have the IO::Zlib module installed, Archive::Tar will also support compressed or gzipped tar files.</p>

<p>An object of class Archive::Tar represents a .tar(.gz) archive full of files and things.</p>

<h1 id="Object-Methods"><a class="permalink" href="./Archive::Tar.html#Object-Methods">#</a><a id="Object"></a>Object Methods</h1>

<h2 id="Archive::Tar-&gt;new(-[$file,-$compressed]-)"><a class="permalink" href="./Archive::Tar.html#Archive::Tar-%3Enew(-%5B$file,-$compressed%5D-)">#</a><a id="Archive"></a><a id="Archive::Tar-new-file-compressed"></a>Archive::Tar-&gt;new( [$file, $compressed] )</h2>

<p>Returns a new Tar object. If given any arguments, <code>new()</code> calls the <code>read()</code> method automatically, passing on the arguments provided to the <code>read()</code> method.</p>

<p>If <code>new()</code> is invoked with arguments and the <code>read()</code> method fails for any reason, <code>new()</code> returns undef.</p>

<h2 id="$tar-&gt;read-(-$filename|$handle,-[$compressed,-{opt-=&gt;-&#39;val&#39;}]-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Eread-(-$filename%7C$handle,-%5B$compressed,-%7Bopt-=%3E-&#39;val&#39;%7D%5D-)">#</a><a id="read"></a><a id="tar-read-filename-handle-compressed-opt-val"></a>$tar-&gt;read ( $filename|$handle, [$compressed, {opt =&gt; &#39;val&#39;}] )</h2>

<p>Read the given tar file into memory. The first argument can either be the name of a file or a reference to an already open filehandle (or an IO::Zlib object if it&#39;s compressed)</p>

<p>The <code>read</code> will <i>replace</i> any previous content in <code>$tar</code>!</p>

<p>The second argument may be considered optional, but remains for backwards compatibility. Archive::Tar now looks at the file magic to determine what class should be used to open the file and will transparently Do The Right Thing.</p>

<p>Archive::Tar will warn if you try to pass a bzip2 / xz compressed file and the IO::Uncompress::Bunzip2 / IO::Uncompress::UnXz are not available and simply return.</p>

<p>Note that you can currently <b>not</b> pass a <code>gzip</code> compressed filehandle, which is not opened with <code>IO::Zlib</code>, a <code>bzip2</code> compressed filehandle, which is not opened with <code>IO::Uncompress::Bunzip2</code>, a <code>xz</code> compressed filehandle, which is not opened with <code>IO::Uncompress::UnXz</code>, nor a string containing the full archive information (either compressed or uncompressed). These are worth while features, but not currently implemented. See the <code>TODO</code> section.</p>

<p>The third argument can be a hash reference with options. Note that all options are case-sensitive.</p>

<dl>

<dt id="limit"><a class="permalink" href="./Archive::Tar.html#limit">#</a>limit</dt>
<dd>

<p>Do not read more than <code>limit</code> files. This is useful if you have very big archives, and are only interested in the first few files.</p>

</dd>
<dt id="filter"><a class="permalink" href="./Archive::Tar.html#filter">#</a>filter</dt>
<dd>

<p>Can be set to a regular expression. Only files with names that match the expression will be read.</p>

</dd>
<dt id="md5"><a class="permalink" href="./Archive::Tar.html#md5">#</a>md5</dt>
<dd>

<p>Set to 1 and the md5sum of files will be returned (instead of file data) my $iter = Archive::Tar-&gt;iter( $file, 1, {md5 =&gt; 1} ); while( my $f = $iter-&gt;() ) { print $f-&gt;data . &quot;\t&quot; . $f-&gt;full_path . $/; }</p>

</dd>
<dt id="extract"><a class="permalink" href="./Archive::Tar.html#extract">#</a>extract</dt>
<dd>

<p>If set to true, immediately extract entries when reading them. This gives you the same memory break as the <code>extract_archive</code> function. Note however that entries will not be read into memory, but written straight to disk. This means no <code>Archive::Tar::File</code> objects are created for you to inspect.</p>

</dd>
</dl>

<p>All files are stored internally as <code>Archive::Tar::File</code> objects. Please consult the <a href="./Archive::Tar::File.html">Archive::Tar::File</a> documentation for details.</p>

<p>Returns the number of files read in scalar context, and a list of <code>Archive::Tar::File</code> objects in list context.</p>

<h2 id="$tar-&gt;contains_file(-$filename-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Econtains_file(-$filename-)">#</a><a id="contains_file"></a><a id="tar-contains_file-filename"></a>$tar-&gt;contains_file( $filename )</h2>

<p>Check if the archive contains a certain file. It will return true if the file is in the archive, false otherwise.</p>

<p>Note however, that this function does an exact match using <code>eq</code> on the full path. So it cannot compensate for case-insensitive file- systems or compare 2 paths to see if they would point to the same underlying file.</p>

<h2 id="$tar-&gt;extract(-[@filenames]-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Eextract(-%5B@filenames%5D-)">#</a><a id="extract1"></a><a id="tar-extract-filenames"></a>$tar-&gt;extract( [@filenames] )</h2>

<p>Write files whose names are equivalent to any of the names in <code>@filenames</code> to disk, creating subdirectories as necessary. This might not work too well under VMS. Under MacPerl, the file&#39;s modification time will be converted to the MacOS zero of time, and appropriate conversions will be done to the path. However, the length of each element of the path is not inspected to see whether it&#39;s longer than MacOS currently allows (32 characters).</p>

<p>If <code>extract</code> is called without a list of file names, the entire contents of the archive are extracted.</p>

<p>Returns a list of filenames extracted.</p>

<h2 id="$tar-&gt;extract_file(-$file,-[$extract_path]-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Eextract_file(-$file,-%5B$extract_path%5D-)">#</a><a id="extract_file"></a><a id="tar-extract_file-file-extract_path"></a>$tar-&gt;extract_file( $file, [$extract_path] )</h2>

<p>Write an entry, whose name is equivalent to the file name provided to disk. Optionally takes a second parameter, which is the full native path (including filename) the entry will be written to.</p>

<p>For example:</p>

<pre><code>$tar-&gt;extract_file( &#39;name/in/archive&#39;, &#39;name/i/want/to/give/it&#39; );

$tar-&gt;extract_file( $at_file_object,   &#39;name/i/want/to/give/it&#39; );</code></pre>

<p>Returns true on success, false on failure.</p>

<h2 id="$tar-&gt;list_files(-[\@properties]-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Elist_files(-%5B%5C@properties%5D-)">#</a><a id="list_files"></a><a id="tar-list_files-properties"></a>$tar-&gt;list_files( [\@properties] )</h2>

<p>Returns a list of the names of all the files in the archive.</p>

<p>If <code>list_files()</code> is passed an array reference as its first argument it returns a list of hash references containing the requested properties of each file. The following list of properties is supported: name, size, mtime (last modified date), mode, uid, gid, linkname, uname, gname, devmajor, devminor, prefix.</p>

<p>Passing an array reference containing only one element, &#39;name&#39;, is special cased to return a list of names rather than a list of hash references, making it equivalent to calling <code>list_files</code> without arguments.</p>

<h2 id="$tar-&gt;get_files(-[@filenames]-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Eget_files(-%5B@filenames%5D-)">#</a><a id="get_files"></a><a id="tar-get_files-filenames"></a>$tar-&gt;get_files( [@filenames] )</h2>

<p>Returns the <code>Archive::Tar::File</code> objects matching the filenames provided. If no filename list was passed, all <code>Archive::Tar::File</code> objects in the current Tar object are returned.</p>

<p>Please refer to the <code>Archive::Tar::File</code> documentation on how to handle these objects.</p>

<h2 id="$tar-&gt;get_content(-$file-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Eget_content(-$file-)">#</a><a id="get_content"></a><a id="tar-get_content-file"></a>$tar-&gt;get_content( $file )</h2>

<p>Return the content of the named file.</p>

<h2 id="$tar-&gt;replace_content(-$file,-$content-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Ereplace_content(-$file,-$content-)">#</a><a id="replace_content"></a><a id="tar-replace_content-file-content"></a>$tar-&gt;replace_content( $file, $content )</h2>

<p>Make the string $content be the content for the file named $file.</p>

<h2 id="$tar-&gt;rename(-$file,-$new_name-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Erename(-$file,-$new_name-)">#</a><a id="rename"></a><a id="tar-rename-file-new_name"></a>$tar-&gt;rename( $file, $new_name )</h2>

<p>Rename the file of the in-memory archive to $new_name.</p>

<p>Note that you must specify a Unix path for $new_name, since per tar standard, all files in the archive must be Unix paths.</p>

<p>Returns true on success and false on failure.</p>

<h2 id="$tar-&gt;chmod(-$file,-$mode-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Echmod(-$file,-$mode-)">#</a><a id="chmod"></a><a id="tar-chmod-file-mode"></a>$tar-&gt;chmod( $file, $mode )</h2>

<p>Change mode of $file to $mode.</p>

<p>Returns true on success and false on failure.</p>

<h2 id="$tar-&gt;chown(-$file,-$uname-[,-$gname]-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Echown(-$file,-$uname-%5B,-$gname%5D-)">#</a><a id="chown"></a><a id="tar-chown-file-uname-gname"></a>$tar-&gt;chown( $file, $uname [, $gname] )</h2>

<p>Change owner $file to $uname and $gname.</p>

<p>Returns true on success and false on failure.</p>

<h2 id="$tar-&gt;remove-(@filenamelist)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Eremove-(@filenamelist)">#</a><a id="remove"></a><a id="tar-remove-filenamelist"></a>$tar-&gt;remove (@filenamelist)</h2>

<p>Removes any entries with names matching any of the given filenames from the in-memory archive. Returns a list of <code>Archive::Tar::File</code> objects that remain.</p>

<h2 id="$tar-&gt;clear"><a class="permalink" href="./Archive::Tar.html#$tar-%3Eclear">#</a><a id="clear"></a><a id="tar-clear"></a>$tar-&gt;clear</h2>

<p><code>clear</code> clears the current in-memory archive. This effectively gives you a &#39;blank&#39; object, ready to be filled again. Note that <code>clear</code> only has effect on the object, not the underlying tarfile.</p>

<h2 id="$tar-&gt;write-(-[$file,-$compressed,-$prefix]-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Ewrite-(-%5B$file,-$compressed,-$prefix%5D-)">#</a><a id="write"></a><a id="tar-write-file-compressed-prefix"></a>$tar-&gt;write ( [$file, $compressed, $prefix] )</h2>

<p>Write the in-memory archive to disk. The first argument can either be the name of a file or a reference to an already open filehandle (a GLOB reference).</p>

<p>The second argument is used to indicate compression. You can compress using <code>gzip</code>, <code>bzip2</code> or <code>xz</code>. If you pass a digit, it&#39;s assumed to be the <code>gzip</code> compression level (between 1 and 9), but the use of constants is preferred:</p>

<pre><code># write a gzip compressed file
$tar-&gt;write( &#39;out.tgz&#39;, COMPRESS_GZIP );

# write a bzip compressed file
$tar-&gt;write( &#39;out.tbz&#39;, COMPRESS_BZIP );

# write a xz compressed file
$tar-&gt;write( &#39;out.txz&#39;, COMPRESS_XZ );</code></pre>

<p>Note that when you pass in a filehandle, the compression argument is ignored, as all files are printed verbatim to your filehandle. If you wish to enable compression with filehandles, use an <code>IO::Zlib</code>, <code>IO::Compress::Bzip2</code> or <code>IO::Compress::Xz</code> filehandle instead.</p>

<p>The third argument is an optional prefix. All files will be tucked away in the directory you specify as prefix. So if you have files &#39;a&#39; and &#39;b&#39; in your archive, and you specify &#39;foo&#39; as prefix, they will be written to the archive as &#39;foo/a&#39; and &#39;foo/b&#39;.</p>

<p>If no arguments are given, <code>write</code> returns the entire formatted archive as a string, which could be useful if you&#39;d like to stuff the archive into a socket or a pipe to gzip or something.</p>

<h2 id="$tar-&gt;add_files(-@filenamelist-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Eadd_files(-@filenamelist-)">#</a><a id="add_files"></a><a id="tar-add_files-filenamelist"></a>$tar-&gt;add_files( @filenamelist )</h2>

<p>Takes a list of filenames and adds them to the in-memory archive.</p>

<p>The path to the file is automatically converted to a Unix like equivalent for use in the archive, and, if on MacOS, the file&#39;s modification time is converted from the MacOS epoch to the Unix epoch. So tar archives created on MacOS with <b>Archive::Tar</b> can be read both with <i>tar</i> on Unix and applications like <i>suntar</i> or <i>Stuffit Expander</i> on MacOS.</p>

<p>Be aware that the file&#39;s type/creator and resource fork will be lost, which is usually what you want in cross-platform archives.</p>

<p>Instead of a filename, you can also pass it an existing <code>Archive::Tar::File</code> object from, for example, another archive. The object will be clone, and effectively be a copy of the original, not an alias.</p>

<p>Returns a list of <code>Archive::Tar::File</code> objects that were just added.</p>

<h2 id="$tar-&gt;add_data-(-$filename,-$data,-[$opthashref]-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Eadd_data-(-$filename,-$data,-%5B$opthashref%5D-)">#</a><a id="add_data"></a><a id="tar-add_data-filename-data-opthashref"></a>$tar-&gt;add_data ( $filename, $data, [$opthashref] )</h2>

<p>Takes a filename, a scalar full of data and optionally a reference to a hash with specific options.</p>

<p>Will add a file to the in-memory archive, with name <code>$filename</code> and content <code>$data</code>. Specific properties can be set using <code>$opthashref</code>. The following list of properties is supported: name, size, mtime (last modified date), mode, uid, gid, linkname, uname, gname, devmajor, devminor, prefix, type. (On MacOS, the file&#39;s path and modification times are converted to Unix equivalents.)</p>

<p>Valid values for the file type are the following constants defined by Archive::Tar::Constant:</p>

<dl>

<dt id="FILE"><a class="permalink" href="./Archive::Tar.html#FILE">#</a>FILE</dt>
<dd>

<p>Regular file.</p>

</dd>
<dt id="HARDLINK"><a class="permalink" href="./Archive::Tar.html#HARDLINK">#</a>HARDLINK</dt>
<dd>

</dd>
<dt id="SYMLINK"><a class="permalink" href="./Archive::Tar.html#SYMLINK">#</a>SYMLINK</dt>
<dd>

<p>Hard and symbolic (&quot;soft&quot;) links; linkname should specify target.</p>

</dd>
<dt id="CHARDEV"><a class="permalink" href="./Archive::Tar.html#CHARDEV">#</a>CHARDEV</dt>
<dd>

</dd>
<dt id="BLOCKDEV"><a class="permalink" href="./Archive::Tar.html#BLOCKDEV">#</a>BLOCKDEV</dt>
<dd>

<p>Character and block devices. devmajor and devminor should specify the major and minor device numbers.</p>

</dd>
<dt id="DIR"><a class="permalink" href="./Archive::Tar.html#DIR">#</a>DIR</dt>
<dd>

<p>Directory.</p>

</dd>
<dt id="FIFO"><a class="permalink" href="./Archive::Tar.html#FIFO">#</a>FIFO</dt>
<dd>

<p>FIFO (named pipe).</p>

</dd>
<dt id="SOCKET"><a class="permalink" href="./Archive::Tar.html#SOCKET">#</a>SOCKET</dt>
<dd>

<p>Socket.</p>

</dd>
</dl>

<p>Returns the <code>Archive::Tar::File</code> object that was just added, or <code>undef</code> on failure.</p>

<h2 id="$tar-&gt;error(-[$BOOL]-)"><a class="permalink" href="./Archive::Tar.html#$tar-%3Eerror(-%5B$BOOL%5D-)">#</a><a id="error"></a><a id="tar-error-BOOL"></a>$tar-&gt;error( [$BOOL] )</h2>

<p>Returns the current error string (usually, the last error reported). If a true value was specified, it will give the <code>Carp::longmess</code> equivalent of the error, in effect giving you a stacktrace.</p>

<p>For backwards compatibility, this error is also available as <code>$Archive::Tar::error</code> although it is much recommended you use the method call instead.</p>

<h2 id="$tar-&gt;setcwd(-$cwd-);"><a class="permalink" href="./Archive::Tar.html#$tar-%3Esetcwd(-$cwd-);">#</a><a id="setcwd"></a><a id="tar-setcwd-cwd"></a>$tar-&gt;setcwd( $cwd );</h2>

<p><code>Archive::Tar</code> needs to know the current directory, and it will run <code>Cwd::cwd()</code> <i>every</i> time it extracts a <i>relative</i> entry from the tarfile and saves it in the file system. (As of version 1.30, however, <code>Archive::Tar</code> will use the speed optimization described below automatically, so it&#39;s only relevant if you&#39;re using <code>extract_file()</code>).</p>

<p>Since <code>Archive::Tar</code> doesn&#39;t change the current directory internally while it is extracting the items in a tarball, all calls to <code>Cwd::cwd()</code> can be avoided if we can guarantee that the current directory doesn&#39;t get changed externally.</p>

<p>To use this performance boost, set the current directory via</p>

<pre><code>use Cwd;
$tar-&gt;setcwd( cwd() );</code></pre>

<p>once before calling a function like <code>extract_file</code> and <code>Archive::Tar</code> will use the current directory setting from then on and won&#39;t call <code>Cwd::cwd()</code> internally.</p>

<p>To switch back to the default behaviour, use</p>

<pre><code>$tar-&gt;setcwd( undef );</code></pre>

<p>and <code>Archive::Tar</code> will call <code>Cwd::cwd()</code> internally again.</p>

<p>If you&#39;re using <code>Archive::Tar</code>&#39;s <code>extract()</code> method, <code>setcwd()</code> will be called for you.</p>

<h1 id="Class-Methods"><a class="permalink" href="./Archive::Tar.html#Class-Methods">#</a><a id="Class"></a>Class Methods</h1>

<h2 id="Archive::Tar-&gt;create_archive($file,-$compressed,-@filelist)"><a class="permalink" href="./Archive::Tar.html#Archive::Tar-%3Ecreate_archive($file,-$compressed,-@filelist)">#</a><a id="Archive1"></a><a id="Archive::Tar-create_archive-file-compressed-filelist"></a>Archive::Tar-&gt;create_archive($file, $compressed, @filelist)</h2>

<p>Creates a tar file from the list of files provided. The first argument can either be the name of the tar file to create or a reference to an open file handle (e.g. a GLOB reference).</p>

<p>The second argument is used to indicate compression. You can compress using <code>gzip</code>, <code>bzip2</code> or <code>xz</code>. If you pass a digit, it&#39;s assumed to be the <code>gzip</code> compression level (between 1 and 9), but the use of constants is preferred:</p>

<pre><code># write a gzip compressed file
Archive::Tar-&gt;create_archive( &#39;out.tgz&#39;, COMPRESS_GZIP, @filelist );

# write a bzip compressed file
Archive::Tar-&gt;create_archive( &#39;out.tbz&#39;, COMPRESS_BZIP, @filelist );

# write a xz compressed file
Archive::Tar-&gt;create_archive( &#39;out.txz&#39;, COMPRESS_XZ, @filelist );</code></pre>

<p>Note that when you pass in a filehandle, the compression argument is ignored, as all files are printed verbatim to your filehandle. If you wish to enable compression with filehandles, use an <code>IO::Zlib</code>, <code>IO::Compress::Bzip2</code> or <code>IO::Compress::Xz</code> filehandle instead.</p>

<p>The remaining arguments list the files to be included in the tar file. These files must all exist. Any files which don&#39;t exist or can&#39;t be read are silently ignored.</p>

<p>If the archive creation fails for any reason, <code>create_archive</code> will return false. Please use the <code>error</code> method to find the cause of the failure.</p>

<p>Note that this method does not write <code>on the fly</code> as it were; it still reads all the files into memory before writing out the archive. Consult the FAQ below if this is a problem.</p>

<h2 id="Archive::Tar-&gt;iter(-$filename,-[-$compressed,-{opt-=&gt;-$val}-]-)"><a class="permalink" href="./Archive::Tar.html#Archive::Tar-%3Eiter(-$filename,-%5B-$compressed,-%7Bopt-=%3E-$val%7D-%5D-)">#</a><a id="Archive2"></a><a id="Archive::Tar-iter-filename-compressed-opt-val"></a>Archive::Tar-&gt;iter( $filename, [ $compressed, {opt =&gt; $val} ] )</h2>

<p>Returns an iterator function that reads the tar file without loading it all in memory. Each time the function is called it will return the next file in the tarball. The files are returned as <code>Archive::Tar::File</code> objects. The iterator function returns the empty list once it has exhausted the files contained.</p>

<p>The second argument can be a hash reference with options, which are identical to the arguments passed to <code>read()</code>.</p>

<p>Example usage:</p>

<pre><code>my $next = Archive::Tar-&gt;iter( &quot;example.tar.gz&quot;, 1, {filter =&gt; qr/\.pm$/} );

while( my $f = $next-&gt;() ) {
    print $f-&gt;name, &quot;\n&quot;;

    $f-&gt;extract or warn &quot;Extraction failed&quot;;

    # ....
}</code></pre>

<h2 id="Archive::Tar-&gt;list_archive($file,-$compressed,-[\@properties])"><a class="permalink" href="./Archive::Tar.html#Archive::Tar-%3Elist_archive($file,-$compressed,-%5B%5C@properties%5D)">#</a><a id="Archive3"></a><a id="Archive::Tar-list_archive-file-compressed-properties"></a>Archive::Tar-&gt;list_archive($file, $compressed, [\@properties])</h2>

<p>Returns a list of the names of all the files in the archive. The first argument can either be the name of the tar file to list or a reference to an open file handle (e.g. a GLOB reference).</p>

<p>If <code>list_archive()</code> is passed an array reference as its third argument it returns a list of hash references containing the requested properties of each file. The following list of properties is supported: full_path, name, size, mtime (last modified date), mode, uid, gid, linkname, uname, gname, devmajor, devminor, prefix, type.</p>

<p>See <code>Archive::Tar::File</code> for details about supported properties.</p>

<p>Passing an array reference containing only one element, &#39;name&#39;, is special cased to return a list of names rather than a list of hash references.</p>

<h2 id="Archive::Tar-&gt;extract_archive($file,-$compressed)"><a class="permalink" href="./Archive::Tar.html#Archive::Tar-%3Eextract_archive($file,-$compressed)">#</a><a id="Archive4"></a><a id="Archive::Tar-extract_archive-file-compressed"></a>Archive::Tar-&gt;extract_archive($file, $compressed)</h2>

<p>Extracts the contents of the tar file. The first argument can either be the name of the tar file to create or a reference to an open file handle (e.g. a GLOB reference). All relative paths in the tar file will be created underneath the current working directory.</p>

<p><code>extract_archive</code> will return a list of files it extracted. If the archive extraction fails for any reason, <code>extract_archive</code> will return false. Please use the <code>error</code> method to find the cause of the failure.</p>

<h2 id="$bool-=-Archive::Tar-&gt;has_io_string"><a class="permalink" href="./Archive::Tar.html#$bool-=-Archive::Tar-%3Ehas_io_string">#</a><a id="bool-Archive::Tar-has_io_string"></a>$bool = Archive::Tar-&gt;has_io_string</h2>

<p>Returns true if we currently have <code>IO::String</code> support loaded.</p>

<p>Either <code>IO::String</code> or <code>perlio</code> support is needed to support writing stringified archives. Currently, <code>perlio</code> is the preferred method, if available.</p>

<p>See the <code>GLOBAL VARIABLES</code> section to see how to change this preference.</p>

<h2 id="$bool-=-Archive::Tar-&gt;has_perlio"><a class="permalink" href="./Archive::Tar.html#$bool-=-Archive::Tar-%3Ehas_perlio">#</a><a id="bool-Archive::Tar-has_perlio"></a>$bool = Archive::Tar-&gt;has_perlio</h2>

<p>Returns true if we currently have <code>perlio</code> support loaded.</p>

<p>This requires <code>perl-5.8</code> or higher, compiled with <code>perlio</code></p>

<p>Either <code>IO::String</code> or <code>perlio</code> support is needed to support writing stringified archives. Currently, <code>perlio</code> is the preferred method, if available.</p>

<p>See the <code>GLOBAL VARIABLES</code> section to see how to change this preference.</p>

<h2 id="$bool-=-Archive::Tar-&gt;has_zlib_support"><a class="permalink" href="./Archive::Tar.html#$bool-=-Archive::Tar-%3Ehas_zlib_support">#</a><a id="bool-Archive::Tar-has_zlib_support"></a>$bool = Archive::Tar-&gt;has_zlib_support</h2>

<p>Returns true if <code>Archive::Tar</code> can extract <code>zlib</code> compressed archives</p>

<h2 id="$bool-=-Archive::Tar-&gt;has_bzip2_support"><a class="permalink" href="./Archive::Tar.html#$bool-=-Archive::Tar-%3Ehas_bzip2_support">#</a><a id="bool-Archive::Tar-has_bzip2_support"></a>$bool = Archive::Tar-&gt;has_bzip2_support</h2>

<p>Returns true if <code>Archive::Tar</code> can extract <code>bzip2</code> compressed archives</p>

<h2 id="$bool-=-Archive::Tar-&gt;has_xz_support"><a class="permalink" href="./Archive::Tar.html#$bool-=-Archive::Tar-%3Ehas_xz_support">#</a><a id="bool-Archive::Tar-has_xz_support"></a>$bool = Archive::Tar-&gt;has_xz_support</h2>

<p>Returns true if <code>Archive::Tar</code> can extract <code>xz</code> compressed archives</p>

<h2 id="Archive::Tar-&gt;can_handle_compressed_files"><a class="permalink" href="./Archive::Tar.html#Archive::Tar-%3Ecan_handle_compressed_files">#</a><a id="Archive5"></a><a id="Archive::Tar-can_handle_compressed_files"></a>Archive::Tar-&gt;can_handle_compressed_files</h2>

<p>A simple checking routine, which will return true if <code>Archive::Tar</code> is able to uncompress compressed archives on the fly with <code>IO::Zlib</code>, <code>IO::Compress::Bzip2</code> and <code>IO::Compress::Xz</code> or false if not both are installed.</p>

<p>You can use this as a shortcut to determine whether <code>Archive::Tar</code> will do what you think before passing compressed archives to its <code>read</code> method.</p>

<h1 id="GLOBAL-VARIABLES"><a class="permalink" href="./Archive::Tar.html#GLOBAL-VARIABLES">#</a><a id="GLOBAL"></a>GLOBAL VARIABLES</h1>

<h2 id="$Archive::Tar::FOLLOW_SYMLINK"><a class="permalink" href="./Archive::Tar.html#$Archive::Tar::FOLLOW_SYMLINK">#</a><a id="Archive::Tar::FOLLOW_SYMLINK"></a>$Archive::Tar::FOLLOW_SYMLINK</h2>

<p>Set this variable to <code>1</code> to make <code>Archive::Tar</code> effectively make a copy of the file when extracting. Default is <code>0</code>, which means the symlink stays intact. Of course, you will have to pack the file linked to as well.</p>

<p>This option is checked when you write out the tarfile using <code>write</code> or <code>create_archive</code>.</p>

<p>This works just like <code>/bin/tar</code>&#39;s <code>-h</code> option.</p>

<h2 id="$Archive::Tar::CHOWN"><a class="permalink" href="./Archive::Tar.html#$Archive::Tar::CHOWN">#</a><a id="Archive::Tar::CHOWN"></a>$Archive::Tar::CHOWN</h2>

<p>By default, <code>Archive::Tar</code> will try to <code>chown</code> your files if it is able to. In some cases, this may not be desired. In that case, set this variable to <code>0</code> to disable <code>chown</code>-ing, even if it were possible.</p>

<p>The default is <code>1</code>.</p>

<h2 id="$Archive::Tar::CHMOD"><a class="permalink" href="./Archive::Tar.html#$Archive::Tar::CHMOD">#</a><a id="Archive::Tar::CHMOD"></a>$Archive::Tar::CHMOD</h2>

<p>By default, <code>Archive::Tar</code> will try to <code>chmod</code> your files to whatever mode was specified for the particular file in the archive. In some cases, this may not be desired. In that case, set this variable to <code>0</code> to disable <code>chmod</code>-ing.</p>

<p>The default is <code>1</code>.</p>

<h2 id="$Archive::Tar::SAME_PERMISSIONS"><a class="permalink" href="./Archive::Tar.html#$Archive::Tar::SAME_PERMISSIONS">#</a><a id="Archive::Tar::SAME_PERMISSIONS"></a>$Archive::Tar::SAME_PERMISSIONS</h2>

<p>When, <code>$Archive::Tar::CHMOD</code> is enabled, this setting controls whether the permissions on files from the archive are used without modification of if they are filtered by removing any setid bits and applying the current umask.</p>

<p>The default is <code>1</code> for the root user and <code>0</code> for normal users.</p>

<h2 id="$Archive::Tar::DO_NOT_USE_PREFIX"><a class="permalink" href="./Archive::Tar.html#$Archive::Tar::DO_NOT_USE_PREFIX">#</a><a id="Archive::Tar::DO_NOT_USE_PREFIX"></a>$Archive::Tar::DO_NOT_USE_PREFIX</h2>

<p>By default, <code>Archive::Tar</code> will try to put paths that are over 100 characters in the <code>prefix</code> field of your tar header, as defined per POSIX-standard. However, some (older) tar programs do not implement this spec. To retain compatibility with these older or non-POSIX compliant versions, you can set the <code>$DO_NOT_USE_PREFIX</code> variable to a true value, and <code>Archive::Tar</code> will use an alternate way of dealing with paths over 100 characters by using the <code>GNU Extended Header</code> feature.</p>

<p>Note that clients who do not support the <code>GNU Extended Header</code> feature will not be able to read these archives. Such clients include tars on <code>Solaris</code>, <code>Irix</code> and <code>AIX</code>.</p>

<p>The default is <code>0</code>.</p>

<h2 id="$Archive::Tar::DEBUG"><a class="permalink" href="./Archive::Tar.html#$Archive::Tar::DEBUG">#</a><a id="Archive::Tar::DEBUG"></a>$Archive::Tar::DEBUG</h2>

<p>Set this variable to <code>1</code> to always get the <code>Carp::longmess</code> output of the warnings, instead of the regular <code>carp</code>. This is the same message you would get by doing:</p>

<pre><code>$tar-&gt;error(1);</code></pre>

<p>Defaults to <code>0</code>.</p>

<h2 id="$Archive::Tar::WARN"><a class="permalink" href="./Archive::Tar.html#$Archive::Tar::WARN">#</a><a id="Archive::Tar::WARN"></a>$Archive::Tar::WARN</h2>

<p>Set this variable to <code>0</code> if you do not want any warnings printed. Personally I recommend against doing this, but people asked for the option. Also, be advised that this is of course not threadsafe.</p>

<p>Defaults to <code>1</code>.</p>

<h2 id="$Archive::Tar::error"><a class="permalink" href="./Archive::Tar.html#$Archive::Tar::error">#</a><a id="Archive::Tar::error"></a>$Archive::Tar::error</h2>

<p>Holds the last reported error. Kept for historical reasons, but its use is very much discouraged. Use the <code>error()</code> method instead:</p>

<pre><code>warn $tar-&gt;error unless $tar-&gt;extract;</code></pre>

<p>Note that in older versions of this module, the <code>error()</code> method would return an effectively global value even when called an instance method as above. This has since been fixed, and multiple instances of <code>Archive::Tar</code> now have separate error strings.</p>

<h2 id="$Archive::Tar::INSECURE_EXTRACT_MODE"><a class="permalink" href="./Archive::Tar.html#$Archive::Tar::INSECURE_EXTRACT_MODE">#</a><a id="Archive::Tar::INSECURE_EXTRACT_MODE"></a>$Archive::Tar::INSECURE_EXTRACT_MODE</h2>

<p>This variable indicates whether <code>Archive::Tar</code> should allow files to be extracted outside their current working directory.</p>

<p>Allowing this could have security implications, as a malicious tar archive could alter or replace any file the extracting user has permissions to. Therefor, the default is to not allow insecure extractions.</p>

<p>If you trust the archive, or have other reasons to allow the archive to write files outside your current working directory, set this variable to <code>true</code>.</p>

<p>Note that this is a backwards incompatible change from version <code>1.36</code> and before.</p>

<h2 id="$Archive::Tar::HAS_PERLIO"><a class="permalink" href="./Archive::Tar.html#$Archive::Tar::HAS_PERLIO">#</a><a id="Archive::Tar::HAS_PERLIO"></a>$Archive::Tar::HAS_PERLIO</h2>

<p>This variable holds a boolean indicating if we currently have <code>perlio</code> support loaded. This will be enabled for any perl greater than <code>5.8</code> compiled with <code>perlio</code>.</p>

<p>If you feel strongly about disabling it, set this variable to <code>false</code>. Note that you will then need <code>IO::String</code> installed to support writing stringified archives.</p>

<p>Don&#39;t change this variable unless you <b>really</b> know what you&#39;re doing.</p>

<h2 id="$Archive::Tar::HAS_IO_STRING"><a class="permalink" href="./Archive::Tar.html#$Archive::Tar::HAS_IO_STRING">#</a><a id="Archive::Tar::HAS_IO_STRING"></a>$Archive::Tar::HAS_IO_STRING</h2>

<p>This variable holds a boolean indicating if we currently have <code>IO::String</code> support loaded. This will be enabled for any perl that has a loadable <code>IO::String</code> module.</p>

<p>If you feel strongly about disabling it, set this variable to <code>false</code>. Note that you will then need <code>perlio</code> support from your perl to be able to write stringified archives.</p>

<p>Don&#39;t change this variable unless you <b>really</b> know what you&#39;re doing.</p>

<h2 id="$Archive::Tar::ZERO_PAD_NUMBERS"><a class="permalink" href="./Archive::Tar.html#$Archive::Tar::ZERO_PAD_NUMBERS">#</a><a id="Archive::Tar::ZERO_PAD_NUMBERS"></a>$Archive::Tar::ZERO_PAD_NUMBERS</h2>

<p>This variable holds a boolean indicating if we will create zero padded numbers for <code>size</code>, <code>mtime</code> and <code>checksum</code>. The default is <code>0</code>, indicating that we will create space padded numbers. Added for compatibility with <code>busybox</code> implementations.</p>

<h2 id="Tuning-the-way-RESOLVE_SYMLINK-will-works"><a class="permalink" href="./Archive::Tar.html#Tuning-the-way-RESOLVE_SYMLINK-will-works">#</a><a id="Tuning"></a>Tuning the way RESOLVE_SYMLINK will works</h2>

<pre><code>	You can tune the behaviour by setting the $Archive::Tar::RESOLVE_SYMLINK variable,
	or $ENV{PERL5_AT_RESOLVE_SYMLINK} before loading the module Archive::Tar.

  Values can be one of the following:

		none
           Disable this mechanism and failed as it was in previous version (&lt;1.88)

		speed (default)
           If you prefer speed
           this will read again the whole archive using read() so all entries
           will be available

    memory
           If you prefer memory

	Limitation

		It won&#39;t work for terminal, pipe or sockets or every non seekable source.</code></pre>

<h1 id="FAQ"><a class="permalink" href="./Archive::Tar.html#FAQ">#</a>FAQ</h1>

<dl>

<dt id="What&#39;s-the-minimum-perl-version-required-to-run-Archive::Tar?"><a class="permalink" href="./Archive::Tar.html#What&#39;s-the-minimum-perl-version-required-to-run-Archive::Tar?">#</a><a id="What"></a><a id="Whats-the-minimum-perl-version-required-to-run-Archive::Tar"></a>What&#39;s the minimum perl version required to run Archive::Tar?</dt>
<dd>

<p>You will need perl version 5.005_03 or newer.</p>

</dd>
<dt id="Isn&#39;t-Archive::Tar-slow?"><a class="permalink" href="./Archive::Tar.html#Isn&#39;t-Archive::Tar-slow?">#</a><a id="Isn"></a><a id="Isnt-Archive::Tar-slow"></a>Isn&#39;t Archive::Tar slow?</dt>
<dd>

<p>Yes it is. It&#39;s pure perl, so it&#39;s a lot slower then your <code>/bin/tar</code> However, it&#39;s very portable. If speed is an issue, consider using <code>/bin/tar</code> instead.</p>

</dd>
<dt id="Isn&#39;t-Archive::Tar-heavier-on-memory-than-/bin/tar?"><a class="permalink" href="./Archive::Tar.html#Isn&#39;t-Archive::Tar-heavier-on-memory-than-/bin/tar?">#</a><a id="Isn1"></a><a id="Isnt-Archive::Tar-heavier-on-memory-than-bin-tar"></a>Isn&#39;t Archive::Tar heavier on memory than /bin/tar?</dt>
<dd>

<p>Yes it is, see previous answer. Since <code>Compress::Zlib</code> and therefore <code>IO::Zlib</code> doesn&#39;t support <code>seek</code> on their filehandles, there is little choice but to read the archive into memory. This is ok if you want to do in-memory manipulation of the archive.</p>

<p>If you just want to extract, use the <code>extract_archive</code> class method instead. It will optimize and write to disk immediately.</p>

<p>Another option is to use the <code>iter</code> class method to iterate over the files in the tarball without reading them all in memory at once.</p>

</dd>
<dt id="Can-you-lazy-load-data-instead?"><a class="permalink" href="./Archive::Tar.html#Can-you-lazy-load-data-instead?">#</a><a id="Can"></a><a id="Can-you-lazy-load-data-instead"></a>Can you lazy-load data instead?</dt>
<dd>

<p>In some cases, yes. You can use the <code>iter</code> class method to iterate over the files in the tarball without reading them all in memory at once.</p>

</dd>
<dt id="How-much-memory-will-an-X-kb-tar-file-need?"><a class="permalink" href="./Archive::Tar.html#How-much-memory-will-an-X-kb-tar-file-need?">#</a><a id="How"></a><a id="How-much-memory-will-an-X-kb-tar-file-need"></a>How much memory will an X kb tar file need?</dt>
<dd>

<p>Probably more than X kb, since it will all be read into memory. If this is a problem, and you don&#39;t need to do in memory manipulation of the archive, consider using the <code>iter</code> class method, or <code>/bin/tar</code> instead.</p>

</dd>
<dt id="What-do-you-do-with-unsupported-filetypes-in-an-archive?"><a class="permalink" href="./Archive::Tar.html#What-do-you-do-with-unsupported-filetypes-in-an-archive?">#</a><a id="What1"></a><a id="What-do-you-do-with-unsupported-filetypes-in-an-archive"></a>What do you do with unsupported filetypes in an archive?</dt>
<dd>

<p><code>Unix</code> has a few filetypes that aren&#39;t supported on other platforms, like <code>Win32</code>. If we encounter a <code>hardlink</code> or <code>symlink</code> we&#39;ll just try to make a copy of the original file, rather than throwing an error.</p>

<p>This does require you to read the entire archive in to memory first, since otherwise we wouldn&#39;t know what data to fill the copy with. (This means that you cannot use the class methods, including <code>iter</code> on archives that have incompatible filetypes and still expect things to work).</p>

<p>For other filetypes, like <code>chardevs</code> and <code>blockdevs</code> we&#39;ll warn that the extraction of this particular item didn&#39;t work.</p>

</dd>
<dt id="I&#39;m-using-WinZip,-or-some-other-non-POSIX-client,-and-files-are-not-being-extracted-properly!"><a class="permalink" href="./Archive::Tar.html#I&#39;m-using-WinZip,-or-some-other-non-POSIX-client,-and-files-are-not-being-extracted-properly!">#</a><a id="I"></a><a id="Im-using-WinZip-or-some-other-non-POSIX-client-and-files-are-not-being-extracted-properly"></a>I&#39;m using WinZip, or some other non-POSIX client, and files are not being extracted properly!</dt>
<dd>

<p>By default, <code>Archive::Tar</code> is in a completely POSIX-compatible mode, which uses the POSIX-specification of <code>tar</code> to store files. For paths greater than 100 characters, this is done using the <code>POSIX header prefix</code>. Non-POSIX-compatible clients may not support this part of the specification, and may only support the <code>GNU Extended Header</code> functionality. To facilitate those clients, you can set the <code>$Archive::Tar::DO_NOT_USE_PREFIX</code> variable to <code>true</code>. See the <code>GLOBAL VARIABLES</code> section for details on this variable.</p>

<p>Note that GNU tar earlier than version 1.14 does not cope well with the <code>POSIX header prefix</code>. If you use such a version, consider setting the <code>$Archive::Tar::DO_NOT_USE_PREFIX</code> variable to <code>true</code>.</p>

</dd>
<dt id="How-do-I-extract-only-files-that-have-property-X-from-an-archive?"><a class="permalink" href="./Archive::Tar.html#How-do-I-extract-only-files-that-have-property-X-from-an-archive?">#</a><a id="How1"></a><a id="How-do-I-extract-only-files-that-have-property-X-from-an-archive"></a>How do I extract only files that have property X from an archive?</dt>
<dd>

<p>Sometimes, you might not wish to extract a complete archive, just the files that are relevant to you, based on some criteria.</p>

<p>You can do this by filtering a list of <code>Archive::Tar::File</code> objects based on your criteria. For example, to extract only files that have the string <code>foo</code> in their title, you would use:</p>

<pre><code>$tar-&gt;extract(
    grep { $_-&gt;full_path =~ /foo/ } $tar-&gt;get_files
);</code></pre>

<p>This way, you can filter on any attribute of the files in the archive. Consult the <code>Archive::Tar::File</code> documentation on how to use these objects.</p>

</dd>
<dt id="How-do-I-access-.tar.Z-files?"><a class="permalink" href="./Archive::Tar.html#How-do-I-access-.tar.Z-files?">#</a><a id="How2"></a><a id="How-do-I-access-.tar.Z-files"></a>How do I access .tar.Z files?</dt>
<dd>

<p>The <code>Archive::Tar</code> module can optionally use <code>Compress::Zlib</code> (via the <code>IO::Zlib</code> module) to access tar files that have been compressed with <code>gzip</code>. Unfortunately tar files compressed with the Unix <code>compress</code> utility cannot be read by <code>Compress::Zlib</code> and so cannot be directly accesses by <code>Archive::Tar</code>.</p>

<p>If the <code>uncompress</code> or <code>gunzip</code> programs are available, you can use one of these workarounds to read <code>.tar.Z</code> files from <code>Archive::Tar</code></p>

<p>Firstly with <code>uncompress</code></p>

<pre><code>use Archive::Tar;

open F, &quot;uncompress -c $filename |&quot;;
my $tar = Archive::Tar-&gt;new(*F);
...</code></pre>

<p>and this with <code>gunzip</code></p>

<pre><code>use Archive::Tar;

open F, &quot;gunzip -c $filename |&quot;;
my $tar = Archive::Tar-&gt;new(*F);
...</code></pre>

<p>Similarly, if the <code>compress</code> program is available, you can use this to write a <code>.tar.Z</code> file</p>

<pre><code>use Archive::Tar;
use IO::File;

my $fh = IO::File-&gt;new( &quot;| compress -c &gt;$filename&quot; );
my $tar = Archive::Tar-&gt;new();
...
$tar-&gt;write($fh);
$fh-&gt;close ;</code></pre>

</dd>
<dt id="How-do-I-handle-Unicode-strings?"><a class="permalink" href="./Archive::Tar.html#How-do-I-handle-Unicode-strings?">#</a><a id="How3"></a><a id="How-do-I-handle-Unicode-strings"></a>How do I handle Unicode strings?</dt>
<dd>

<p><code>Archive::Tar</code> uses byte semantics for any files it reads from or writes to disk. This is not a problem if you only deal with files and never look at their content or work solely with byte strings. But if you use Unicode strings with character semantics, some additional steps need to be taken.</p>

<p>For example, if you add a Unicode string like</p>

<pre><code># Problem
$tar-&gt;add_data(&#39;file.txt&#39;, &quot;Euro: \x{20AC}&quot;);</code></pre>

<p>then there will be a problem later when the tarfile gets written out to disk via <code>$tar-&gt;write()</code>:</p>

<pre><code class="plaintext">Wide character in print at .../Archive/Tar.pm line 1014.</code></pre>

<p>The data was added as a Unicode string and when writing it out to disk, the <code>:utf8</code> line discipline wasn&#39;t set by <code>Archive::Tar</code>, so Perl tried to convert the string to ISO-8859 and failed. The written file now contains garbage.</p>

<p>For this reason, Unicode strings need to be converted to UTF-8-encoded bytestrings before they are handed off to <code>add_data()</code>:</p>

<pre><code>use Encode;
my $data = &quot;Accented character: \x{20AC}&quot;;
$data = encode(&#39;utf8&#39;, $data);

$tar-&gt;add_data(&#39;file.txt&#39;, $data);</code></pre>

<p>A opposite problem occurs if you extract a UTF8-encoded file from a tarball. Using <code>get_content()</code> on the <code>Archive::Tar::File</code> object will return its content as a bytestring, not as a Unicode string.</p>

<p>If you want it to be a Unicode string (because you want character semantics with operations like regular expression matching), you need to decode the UTF8-encoded content and have Perl convert it into a Unicode string:</p>

<pre><code>use Encode;
my $data = $tar-&gt;get_content();

# Make it a Unicode string
$data = decode(&#39;utf8&#39;, $data);</code></pre>

<p>There is no easy way to provide this functionality in <code>Archive::Tar</code>, because a tarball can contain many files, and each of which could be encoded in a different way.</p>

</dd>
</dl>

<h1 id="CAVEATS"><a class="permalink" href="./Archive::Tar.html#CAVEATS">#</a>CAVEATS</h1>

<p>The AIX tar does not fill all unused space in the tar archive with 0x00. This sometimes leads to warning messages from <code>Archive::Tar</code>.</p>

<pre><code class="plaintext">Invalid header block at offset nnn</code></pre>

<p>A fix for that problem is scheduled to be released in the following levels of AIX, all of which should be coming out in the 4th quarter of 2009:</p>

<pre><code class="plaintext">AIX 5.3 TL7 SP10
AIX 5.3 TL8 SP8
AIX 5.3 TL9 SP5
AIX 5.3 TL10 SP2

AIX 6.1 TL0 SP11
AIX 6.1 TL1 SP7
AIX 6.1 TL2 SP6
AIX 6.1 TL3 SP3</code></pre>

<p>The IBM APAR number for this problem is IZ50240 (Reported component ID: 5765G0300 / AIX 5.3). It is possible to get an ifix for that problem. If you need an ifix please contact your local IBM AIX support.</p>

<h1 id="TODO"><a class="permalink" href="./Archive::Tar.html#TODO">#</a>TODO</h1>

<dl>

<dt id="Check-if-passed-in-handles-are-open-for-read/write"><a class="permalink" href="./Archive::Tar.html#Check-if-passed-in-handles-are-open-for-read/write">#</a><a id="Check"></a><a id="Check-if-passed-in-handles-are-open-for-read-write"></a>Check if passed in handles are open for read/write</dt>
<dd>

<p>Currently I don&#39;t know of any portable pure perl way to do this. Suggestions welcome.</p>

</dd>
<dt id="Allow-archives-to-be-passed-in-as-string"><a class="permalink" href="./Archive::Tar.html#Allow-archives-to-be-passed-in-as-string">#</a><a id="Allow"></a>Allow archives to be passed in as string</dt>
<dd>

<p>Currently, we only allow opened filehandles or filenames, but not strings. The internals would need some reworking to facilitate stringified archives.</p>

</dd>
<dt id="Facilitate-processing-an-opened-filehandle-of-a-compressed-archive"><a class="permalink" href="./Archive::Tar.html#Facilitate-processing-an-opened-filehandle-of-a-compressed-archive">#</a><a id="Facilitate"></a>Facilitate processing an opened filehandle of a compressed archive</dt>
<dd>

<p>Currently, we only support this if the filehandle is an IO::Zlib object. Environments, like apache, will present you with an opened filehandle to an uploaded file, which might be a compressed archive.</p>

</dd>
</dl>

<h1 id="SEE-ALSO"><a class="permalink" href="./Archive::Tar.html#SEE-ALSO">#</a><a id="SEE"></a>SEE ALSO</h1>

<dl>

<dt id="The-GNU-tar-specification"><a class="permalink" href="./Archive::Tar.html#The-GNU-tar-specification">#</a><a id="The"></a>The GNU tar specification</dt>
<dd>

<p><code>http://www.gnu.org/software/tar/manual/tar.html</code></p>

</dd>
<dt id="The-PAX-format-specification"><a class="permalink" href="./Archive::Tar.html#The-PAX-format-specification">#</a><a id="The1"></a>The PAX format specification</dt>
<dd>

<p>The specification which tar derives from; <code> http://www.opengroup.org/onlinepubs/007904975/utilities/pax.html</code></p>

</dd>
<dt id="A-comparison-of-GNU-and-POSIX-tar-standards;-http://www.delorie.com/gnu/docs/tar/tar_114.html"><a class="permalink" href="./Archive::Tar.html#A-comparison-of-GNU-and-POSIX-tar-standards;-http://www.delorie.com/gnu/docs/tar/tar_114.html">#</a><a id="A"></a><a id="A-comparison-of-GNU-and-POSIX-tar-standards-http:-www.delorie.com-gnu-docs-tar-tar_114.html"></a>A comparison of GNU and POSIX tar standards; <code>http://www.delorie.com/gnu/docs/tar/tar_114.html</code></dt>
<dd>

</dd>
<dt id="GNU-tar-intends-to-switch-to-POSIX-compatibility"><a class="permalink" href="./Archive::Tar.html#GNU-tar-intends-to-switch-to-POSIX-compatibility">#</a><a id="GNU"></a>GNU tar intends to switch to POSIX compatibility</dt>
<dd>

<p>GNU Tar authors have expressed their intention to become completely POSIX-compatible; <code>http://www.gnu.org/software/tar/manual/html_node/Formats.html</code></p>

</dd>
<dt id="A-Comparison-between-various-tar-implementations"><a class="permalink" href="./Archive::Tar.html#A-Comparison-between-various-tar-implementations">#</a><a id="A1"></a>A Comparison between various tar implementations</dt>
<dd>

<p>Lists known issues and incompatibilities; <code>http://gd.tuwien.ac.at/utils/archivers/star/README.otherbugs</code></p>

</dd>
</dl>

<h1 id="AUTHOR"><a class="permalink" href="./Archive::Tar.html#AUTHOR">#</a>AUTHOR</h1>

<p>This module by Jos Boumans &lt;kane@cpan.org&gt;.</p>

<p>Please reports bugs to &lt;bug-archive-tar@rt.cpan.org&gt;.</p>

<h1 id="ACKNOWLEDGEMENTS"><a class="permalink" href="./Archive::Tar.html#ACKNOWLEDGEMENTS">#</a>ACKNOWLEDGEMENTS</h1>

<p>Thanks to Sean Burke, Chris Nandor, Chip Salzenberg, Tim Heaney, Gisle Aas, Rainer Tammer and especially Andrew Savige for their help and suggestions.</p>

<h1 id="COPYRIGHT"><a class="permalink" href="./Archive::Tar.html#COPYRIGHT">#</a>COPYRIGHT</h1>

<p>This module is copyright (c) 2002 - 2009 Jos Boumans &lt;kane@cpan.org&gt;. All rights reserved.</p>

<p>This library is free software; you may redistribute and/or modify it under the same terms as Perl itself.</p>


      </div>
      <div id="footer">
        <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p>

<p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p>


      </div>
    </div>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script>
    <script src="../highlight.pack.js"></script>
    <script>hljs.highlightAll();</script>
  </body>
</html>
